package zuoye.zuoye06;

import java.util.Scanner;

public class 输入7位同学的成绩 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String[] stuNames = new String[7];
        double[] stuScores = new double[7];
        for(int i = 0;i < stuNames.length;i++){
            System.out.println("请输入学生姓名：");
            stuNames[i] = input.next();
            System.out.println("请输入学生成绩：");
            stuScores[i] = input.nextDouble();
        }
        for (int i = 0;i<stuScores.length;i++){
            for (int j =0;j<stuScores.length-1-i;j++){
                if (stuScores[j]<stuScores[j+1]){
                    double temp=stuScores[j];
                    stuScores[j]=stuScores[j+1];
                    stuScores[j+1]=temp;

                    String strTemp = stuNames[j];
                    stuNames[j] = stuNames[j + 1];
                    stuNames[j + 1] = strTemp;
                }
            }
            System.out.println(stuScores[i]);
        }

        // 最大值
        double max = stuScores[0];
        // 最小值
        double min = stuScores[stuScores.length - 1];

        System.out.println("最高分" + max);
        System.out.println("最低分" + min);
    }
}
